<style scoped>
   .doclist .shark {
        padding: 0 30px;
    }

   .doclist .fast {
        font-size: 20px;
        color: #f39312;
        letter-spacing: 1px;
    }

    .doclist .main .ivu-select,
    .main .ivu-input {
        border-radius: 0 2px 2px 0;
    }

    .doclist .common-box-body {
        padding-top: 24px;
    }
    .doclist .fixed-bottom{
        padding-left: 30px;
        padding-right: 40px ;
        height: 80px;
        line-height: normal !important;
        position: fixed;
        left: 210px;
        right: 0;
        bottom: 0;
        z-index: 999;
        text-align: center;
        background-color: rgb(255, 255, 255);
        box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.28);
    }
    .doclist .sidehide{
        left: 75px;
    }
    .doclist .detail{
        margin-top: 20px ;
        margin-bottom: 15px !important;
    }
</style>
<style>
    .doclist .common-box-body .ivu-select-single .ivu-select-selection .ivu-select-placeholder,
    .common-box-body .ivu-select-single .ivu-select-selection .ivu-select-selected-value {
        padding-right: 0px;
    }

    .doclist .ivu-tabs.ivu-tabs-card>.ivu-tabs-bar .ivu-tabs-tab {
        color: #2d8cf0;
        border-color: transparent;
        background-color: #FFF;
    }

    .doclist .ivu-tabs.ivu-tabs-card>.ivu-tabs-bar .ivu-tabs-tab-active {
        color: #808080;
        border: 1px solid #dddee1;
        border-bottom: 0;
    }
    .doclist button.ivu-btn{
        border-radius:2px !important;
    }
</style>


<template>
    <div class="doclist">
        <product-title></product-title>
        <div class="shark"  style="padding:0 30px;">
            <div class="fast">快速搜索</div>
            <div class="common-box-body">
                <Form >
                    <Row>   
                        <Col :md="24" :lg="4">
                            <FormItem >
                               <Select placeholder="分公司"  v-model="formdata.companyName">
                                    <Option value=" ">全部</Option>    
                                    <Option :value="item.shortn" v-for="item in allcompany" :key="item.id">{{item.shortn}}</Option>
                                </Select>
                            </FormItem>
                        </Col>
                        <!-- <Col :md="24" :lg="4">
                            <FormItem >
                                <Select placeholder="员工姓名"  v-model="formdata.empName">
                                    <Option value=" ">全部</Option>    
                                    <Option :value="item" v-for="item in allempName" :key="item">{{item}}</Option>
                                </Select>
                            </FormItem>
                        </Col> -->
                        <Col :md="24" :lg="4">
                            <FormItem >
                                <DatePicker type="year" placeholder="年度" v-model="formdata.ytime" @on-change="ychange"></DatePicker>
                            </FormItem>
                        </Col>
                        <Col :md="24" :lg="4">
                            <FormItem >
                                <Select placeholder="月份继续率"  v-model="formdata.m" @on-change="threegetone($event,'m')">
                                    <Option value="1">一月</Option>                                  
                                    <Option value="2">二月</Option>                                  
                                    <Option value="3">三月</Option>                                  
                                    <Option value="4">四月</Option>                                  
                                    <Option value="5">五月</Option>                                  
                                    <Option value="6">六月</Option>                                  
                                    <Option value="7">七月</Option>                                  
                                    <Option value="8">八月</Option>                                  
                                    <Option value="9">九月</Option>                                  
                                    <Option value="10">十月</Option>                                  
                                    <Option value="11">十一月</Option>                                  
                                    <Option value="12">十二月</Option>                                  
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :md="24" :lg="4">
                            <FormItem >
                                <Select placeholder="季度继续率"  v-model="formdata.quarter" @on-change="threegetone($event,'quarter')">
                                    <Option value="3">第一季度</Option>                                  
                                    <Option value="6">第二季度</Option>                                  
                                    <Option value="9">第三季度</Option>                                  
                                    <Option value="12">第四季度</Option>                                  
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :md="24" :lg="4">
                            <FormItem >
                                <Select placeholder="年度继续率"  v-model="formdata.yearRate" @on-change="threegetone($event,'yearRate')">
                                    <Option value="6">上半年度</Option>                                  
                                    <Option value="12">下半年度</Option>                                  
                                </Select>
                            </FormItem>
                        </Col>
                        <Col :md="24" :lg="4">
                            <Button size="large" class="fr" type="primary"  @click="jisuan">计算</Button>
                        </Col>
                    </Row>
                </Form>
            </div>
            <div class="detail">
                <div class="clearfix">
                    <div class="table-theme highlight_table">
                        <Table  ref="currentRowTable" @on-current-change="tableCurrentChange($event)" size="large" stripe highlight-row border :columns="columns1" :data="policylist" class=""></Table>
                    </div>                        
                </div>
            </div>
            <!-- <div :class="slidetoggle?'fixed-bottom':'fixed-bottom sidehide' ">
                <Row class="pro-pagesize">
                    <Col :md="24" :lg="24" class="tRight">
                        <Page :total="detailTotal" ref='pages' :current="currentpage" show-total show-sizer :page-size="pagesize" @on-change="pageChange" @on-page-size-change="pageSizeChange" placement="top" class="page"></Page>
                    </Col>
                </Row>
            </div> -->
        </div>
    </div>
</template>

<script>
    import productTitle from '../../components/productTitle'
    import {getListByName} from '../../api/basiclaw'
    import {delete_org,get_list,get_account,set_yun_account} from '../../api/org'
    import { PermissionGetAll } from '../../api/yun_permission'
    import { getCateList  , transferData} from '../../api/yun_org'
    import util from '../../libs/util'
    export default {
        data() {
            return {
                allcompany:[],
                p:1,//对页面页数的定义-->初始化
                pagesize:10,//对页面的定义,出事定义10条数据
                detailTotal: 0,
                showAddModal:false,//点击设置,弹出模态框
                closeable: false,//shif按ese按钮退出
                loading: true,
                tableaction:true, 
                jiance:false,
                currentpage:1,
                formdata:{
                    p:1,//对页面页数的定义-->初始化
                    pagesize:10,//对页面的定义,出事定义10条数据
                    companyName:"",
                    y:'',
                    m:'',
                    quarter:'',
                    yearRate:''                
                } ,
                policylist:[],
                columns1:[
                    {
                        title: '机构简称',
                        key: 'cname',
                        align: 'center',
                    },
                    
                    {
                        title: '应收保费',
                        key: 'Rec',
                        align:'center',
                    },
                    {
                        title: '实收保费',
                        key: 'Received',
                        align:'center',
                    },
                    {
                        title: '继续率',
                        key: 'Rate',
                        align:'center',
                    },
                ],
                permission_list:[],
                orglist:[],
                cateList:[],
                roleList:[],
                org:{
                    org_from:'',
                    org_to:''
                },
                ruleValidate: {
                    org_to:[
                        { required: true, message: '机构不能为空', trigger: 'blur,change' }
                    ],
                },
                current:{}
            }
        },
        components: {
            productTitle
        },
        computed: {
            slidetoggle(){
                return this.$store.state.sildeshow
            },
        },
        created() {
            this.getallcompany();
        },
        mounted(){
        },
        methods: {
            getallcompany(){
                new Promise((resolve, reject) => {
                    getListByName().then(response => {
                        if (response.data.err == 0) {
                            this.allcompany = response.data.data;
                        } else {
                            this.$Message.error(response.data.info);
                        }
                        resolve();
                    }).catch(error => {
                        reject(error);
                    });
                });
            },
            ychange(val){
                this.formdata.y=val;
            },
            threegetone(val,name){
                console.log(val);
                if(val&&name=="yearRate"){
                    this.formdata.m="";
                    this.formdata.quarter="";
                }
                if(name=="m"&&val){
                    this.formdata.yearRate="";
                    this.formdata.quarter="";
                }
                if(name=="quarter"&&val){
                    this.formdata.m="";
                    this.formdata.yearRate="";
                }
                 return false;
            },
            jisuan(){
                new Promise(()=>{
                    // let url="http://192.168.0.136:8180/kb/v1/ContinueRate/cnameRate";
                    let url=BASE_URL1+"/kb/v1/ContinueRate/cnameRate";
                    util.ajax.get(url,{
                        params:this.formdata
                        }).then(res=>{
                        if(res.data.err==0){
                            this.policylist = [res.data.data];
                        }else{
                            this.$Message.error(res.data.info);
                        }
                    })

                }) 
            }
        },
    }
</script>